home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4502 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.cencom.net!ns!tanp
  2. From: tanp@ns (Bill Wendling)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP!!!!!!!
  5. Date: 5 Feb 1996 07:09:50 GMT
  6. Organization: Cen-Com Internet
  7. Message-ID: <4f4afu$4c2@news.cencom.net>
  8. References: <3112CFDA.85@utoronto.ca>
  9. NNTP-Posting-Host: ns.cencom.net
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Dave Goldstein inexplicably wrote:
  13. } I am a frustrated new C programmer, with a big headache:
  14. } I've composed a linked list in a function, and I am passing the HEAD of 
  15. } the list into the function.  Of course, when I pass this into the 
  16. } function, I have to dereference it twice (**head) since I pass it in as 
  17. } &head.  
  18.  
  19. Since this is a linked list, why are you passing head in as &head?  You
  20. should just be able to pass it in as head to a function expecting
  21. the address of head.
  22.  
  23. }    Anyway, to make a long story short, when I try accessing the 
  24. } first item in the linked list (assuming there is one), I have tried 
  25. } accessing it as **head->next which C doesn't seem to like. WHY????!!
  26. } It keeps giving me an error "Pointer to structure required on left side 
  27. } of -> or ->* in function ....".  Isn't that what I'm doing??
  28.  
  29. The -> thingy really dereferences the thing it is pointing to.  So,
  30. **head->next is really **(*head).next which isn't what you want.
  31. You might try changing it to (*head)->next instead.  That might help,
  32. however, I don't have code to go on.
  33.  
  34. } Please help, I'm beginning to feel suicidal!
  35. } If you wish to mail me please write to:
  36.  
  37. } dave.goldstein@utoronto.ca
  38.  
  39. } I'll be forever in your debt!  Thanks.
  40.  
  41. Hmmm...:)
  42.  
  43. --
  44. Bill Wendling         | "Pinky, are you thinking what I'm thinking?"
  45. tanp@ns.cencom.net  | "I think so, Brain, but burlap chafes me so."
  46. "Boom Shanka"       | Finger me for my Geek Code...NOW!
  47.